package com.dody.agile.payment.database;


import com.dody.agile.payment.affilication.Affiliation;
import com.dody.agile.payment.employee.Employee;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author ShiXin
 * @date 2019/4/9 19:51
 * @description ExamStack
 */
public abstract class PayrollDatabase {

    Map<Integer, Employee> itsEmployees = new ConcurrentHashMap<>(64);
    Map<Integer, Employee> itsUnionMembers = new ConcurrentHashMap<>(64);

    public abstract Employee getEmployee(Integer empId);

    public abstract void addEmployee(Integer empId, Employee employee);

    void clear() {
      itsEmployees.clear();
    }

    public abstract void deleteEmployee(Integer empId);

    public abstract void addUnionMember(Integer memberId, Employee e);

    public abstract Employee getUnionMember(Integer memberId);

    public List<Employee> getAllEmployee(){
        List<Employee> employees = new LinkedList<>();
        for (Employee e : itsEmployees.values()) {
            employees.add(e);
        }
        return employees;
    }
}
